Skip to content

Conversation

@Dwij1704
Copy link
Member

@Dwij1704 Dwij1704 commented Apr 30, 2025

📥 Pull Request

Closes #940
📘 Description

  • Introduce IBMWatsonXInstrumentor for OpenTelemetry instrumentation of IBM watsonx.ai API.
  • Implement attribute extraction for model operations including generate, generate_text_stream, tokenize, and get_details.
  • Add support for streaming responses with telemetry tracking.
  • Create utility functions for common attribute processing and parameter extraction.

The insrumentation covers

  • Text generation
  • Chat completions
  • Streaming responses
  • Tokenization
  • Model details

🧪 Testing
(Ping me for ENV vars) -- Update - Added on gist itself
Python >=3.10 <3.13
pip install ibm-watsonx-ai

https://gist.github.com/Dwij1704/532f93989540dd924bb210106faf3049

@codecov
Copy link

codecov bot commented Apr 30, 2025

@Dwij1704 Dwij1704 requested review from areibman and tcdent April 30, 2025 22:16
@Dwij1704 Dwij1704 requested a review from bboynton97 May 2, 2025 21:09
@dot-agi dot-agi requested review from Copilot and dot-agi May 2, 2025 21:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds instrumentation support for the IBM watsonx.ai API in AgentOps, providing telemetry tracking for model operations including text generation, chat completions, streaming responses, tokenization, and model details. Key changes include:

  • Introduction of the IBMWatsonXInstrumentor and dedicated stream wrappers for handling streaming responses.
  • Implementation of utilities for attribute extraction and conversion from IBM watsonx.ai API parameters.
  • Updates to method wrapping to support both standard and streaming API calls.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
agentops/instrumentation/ibm_watsonx_ai/stream_wrapper.py Implements stream wrappers with telemetry for streaming responses.
agentops/instrumentation/ibm_watsonx_ai/instrumentor.py Introduces the IBMWatsonXInstrumentor and method wrapping logic.
agentops/instrumentation/ibm_watsonx_ai/attributes/common.py Provides common attribute extraction utilities and parameter conversion.
agentops/instrumentation/ibm_watsonx_ai/attributes/attributes.py Implements attribute extraction functions for different API operations.
agentops/instrumentation/ibm_watsonx_ai/attributes/init.py Exposes attribute extraction utilities.
agentops/instrumentation/ibm_watsonx_ai/init.py Sets up constants and versioning for IBM watsonx.ai instrumentation.
agentops/instrumentation/init.py Updates the instrumentor loader to include the IBM watsonx.ai instrumentor.

@Dwij1704 Dwij1704 merged commit 3bf788d into main May 2, 2025
7 of 10 checks passed
@Dwij1704 Dwij1704 deleted the watsonxai-instrumentor branch May 2, 2025 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instrument IBM WatsonX LLM

3 participants